

*****IBES ANALYST FOLLOWING (MONTHLY)
use "$jfqa_rep/ibes_detail.dta", clear

qui{
rename CUSIP cusip
rename ANNDATS anndats
rename ESTIMATOR estimator

keep cusip anndats estimator
duplicates drop

*format date
gen year=year(anndats)
gen month=month(anndats)
drop if missing(cusip)

*count recommendations by month
gen estimates=1
collapse (rawsum) estimates, by(cusip year month)
drop if year<1983

sort cusip year month

}

save "$jfqa_rep/15_IBES_Count.dta", replace
